/**
* @author Cheng Liu
**/

#include "stdafx.h"
#include "MiscPluginManager.h"

void MiscPluginManager::Initialize() {
	cine = PluginFacade::Instance();
	loadFileFromPath(TEXT("plugins\\misc\\"));
	CreateAll();
	ActivateAll();
}

void MiscPluginManager::loadFileFromPath( std::basic_string<TCHAR> path ) {
	CFileFind finder;

	BOOL done = finder.FindFile((path + TEXT("*.dll")).c_str());

	while (done) {
		done = finder.FindNextFile();
		LoadModule((path+finder.GetFileName().GetString()).c_str());
	}
}

void MiscPluginManager::ActivateAll() {
	pluginTable::iterator iter;
	for (iter = plugins.begin();iter!=plugins.end();++iter)
		ActivatePlugin(iter->first);
}

void MiscPluginManager::CreateAll() {
	moduleTable::iterator iter;
	for (iter =  modules.begin(); iter!=modules.end(); ++iter) {
		IPlugin *plugin = CreatePluginObject(iter->first);
	}
}